//
// Created by dong on 2025/10/21.
//

#include "SAction.h"

SAction::SAction(Swidget* parent):SButton("action")
{
}

SAction::SAction(const string& text, Swidget* parent):SButton(text,parent)
{
    m_data->x = 0;
    m_data->y=0;
    m_data->w = 200;
    m_data->h = 30;
    m_text=text;
    m_data->isVisible=false;
}

string SAction::text() const
{
    return m_text;
}

bool SAction::event(SDL_Event* msg)
{
    return SButton::event(msg);
}

void SAction::mousePressEvent(SDL_Event* msg)
{

    SButton::mousePressEvent(msg);
    if (Swidget::contains(msg->motion.x,msg->motion.y))
    {
        setvisible(false);
    }

}
